<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>订单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">

<form class="layui-form">
    <blockquote class="layui-elem-quote quoteBox">
        <form class="layui-form">
            <div class="layui-inline">
               <!-- <div class="layui-input-inline">
                    <input type="text" class="layui-input searchVal" placeholder="请输入搜索的内容" />
                </div>
                <a class="layui-btn search_btn" data-type="reload">搜索</a>-->
            </div>
            <div class="layui-inline">
                <a class="layui-btn layui-btn-danger layui-btn-normal delAll_btn">批量删除</a>
            </div>
        </form>
    </blockquote>
    <table id="orderList" lay-filter="orderList">
        <input type="hidden" id="custNo" class="custNo" name="custNo"></input>
    </table>

    <!--操作-->
    <script type="text/html" id="orderListBar">
        <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="look">订单的详情</a>
        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>

    </script>
</form>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table;
        var orderno=$("#custNo").val();

        //联系人列表
        var tableIns = table.render({
            elem: '#orderList',
            url:"orders/selectorder",
            page : false,
            id : "orderListTable",
            where:{
                ordeCustNo:orderno
            },
            cols : [[
                {type: "checkbox", fixed:"left"},
                {field: 'ordeNo', title: '订单编号',align:"center"},
                {field: 'ordeCustNo', title: '客户编号',align:"center"},
                {field: 'ordeDate', title: '订单日期', align:"center"},
                {field: 'ordeAddress', title: '送货地址',align:"center"},
                {field: 'ordeStatus', title: '订单状态',align:"center",templet:function (row) {
                        return row.available==1?"已回款":"未回款";
                    }},
                {field: 'ordeFlag', title: '订单标识',align:"center",templet:function (row) {
                        return row.available==1?"已删除":"未删除";
                    }},
                {title: '操作', width:250, templet:'#orderListBar',fixed:"right",align:"center"}
            ]]
        });

        table.on("tool(orderList)",function (obj) {
            //获取当前行的数据
            var data=obj.data;
            switch (obj.event){
                case 'del':
                    deleteOrderList(data);
                    break;
                case 'look':
                    selectOrderProduct(data);
                    break;

            }
        });

        //顾客订单
        function selectOrderProduct(data){
            var index=layui.layer.open({
                title:"查看订单详情",
                type:2,
                content:"toOrderProductPage.do",
                success:function (layero,index) {
                    var body = layui.layer.getChildFrame('body', index);//少了这个是不能从父页面向子页面传值的
                    body.contents().find(".ordeNo").val(data.ordeNo);
                }
            });
            layui.layer.full(index);//全屏显示
        }






    })

</script>
</body>
</html>